package cn.chenchao.eshop.log.dao.imp;

import cn.chenchao.eshop.log.dao.ISysLog;
import cn.chenchao.eshop.log.entity.Log;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @encoding : UTF-8
 * @Time : 2020/11/23 11:20
 * @Author : Chen Chao
 * @File : eshop.cn.chenchao.eshop.log.dao.imp.CreateLog.java
 * @Software : IntelliJ IDEA
 * @since : 1.8
 * 日志生成类，
 * 封装日志信息
 */
public class CreateLog implements ISysLog {
    private  SimpleDateFormat simpleDateFormat = new SimpleDateFormat("h:mm a");
    @Override
    public Log normal(String msg) {
        return new Log(msg,ISysLog.NORMAL,simpleDateFormat.format(new Date()));
    }

    @Override
    public Log warn(String msg) {
        return new Log(msg,ISysLog.WARN,simpleDateFormat.format(new Date()));
    }

    @Override
    public Log error(String msg) {
        return new Log(msg,ISysLog.ERROR,simpleDateFormat.format(new Date()));
    }
}
